<?php
include_once './inc/config_inc.php';
include_once './inc/mysql_inc.php';
include_once './inc/tool_inc.php';
$link=connect();
$user_id=is_login($link);

$template['title']='首页';
$template['css']=array('style/public.css','style/index.css');
?>
<?php include 'inc/header_inc.php';?>
<!--图片轮转-->
<div class="me">
	<div id="container">
		<div id="photo">
			<img src="style/1.jpeg" />
			<img src="style/2.jpeg" />
			<img src="style/3.jpeg" />
			<img src="style/4.jpeg" />
			<img src="style/5.jpeg" />
		</div>
	</div>
</div>
		
<!--最新发布-->
<div class="new">最新发布</div>
<?php  
$query="select * from life order by create_time desc limit 3 ";
$result_life=execute($link,$query);
$query="update life set times=times+1";
execute($link,$query);
while($data_life=mysqli_fetch_assoc($result_life)){
	$data_life['times']=$data_life['times']+1;
	$data_life['title']=nl2br(htmlspecialchars($data_life['title']));
	$data_life['content']=nl2br(htmlspecialchars($data_life['content']));
?>
<div class="article">
	<div id="title">
		<img src="<?php if($data_life['photo']!=''){echo $data_life['photo'];}else{echo 'style/5.jpeg';}?>">
		<span>
			<p style="font-size: 18px;font-weight: bold;"><?php echo $data_life['title']?></p>
			<p><?php echo $data_life['content']?></p>
		</span>
	</div>
	<div id="comment">发布时间: <?php echo $data_life['create_time']?>&nbsp;&nbsp;&nbsp;浏览: <?php echo $data_life['times']?>&nbsp;&nbsp;&nbsp;</div>
</div>
<?php } ?>
<?php  
$query="select * from note order by create_time desc limit 3";
$result_note=execute($link,$query);
$query="update note set times=times+1";
execute($link,$query);
while($data_note=mysqli_fetch_assoc($result_note)){
	$data_note['times']=$data_note['times']+1;
	$data_note['title']=nl2br(htmlspecialchars($data_note['title']));
	$data_note['content']=nl2br(htmlspecialchars($data_note['content']));
?>
<div class="article">
	<div id="title">
		<img src="<?php if($data_note['photo']!=''){echo $data_note['photo'];}else{echo 'style/3.jpeg';}?>">
		<span>
			<p style="font-size: 18px;font-weight: bold;"><?php echo $data_note['title']?></p>
			<p><?php echo $data_note['content']?></p>
		</span>
	</div>
	<div id="comment">发布时间: <?php echo $data_note['create_time']?>&nbsp;&nbsp;&nbsp;浏览: <?php echo $data_note['times']?>&nbsp;&nbsp;&nbsp;</div>
</div>
<?php } ?>
<?php include 'inc/footer_inc.php';?>